﻿using SmartSapce.ServiceLocation;
using SmartSpace.Web;
using SmartSpace.Workflow;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SmartSpace.WebApp.Modules.Workflow
{
    public partial class Workflow_Create : SsTemplatePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void _ctlBtnSave_Click(object sender, EventArgs e)
        {
            IWorkflowService service = ServiceLocator.Get<IWorkflowService>();
            WorkflowMetadata workflow = new WorkflowMetadata();
            workflow.Id = Guid.NewGuid();
            workflow.Code = _ctlEditCode.Text;
            workflow.Caption = _ctlEditCaption.Text;

            if (service.SaveWorkflow(workflow).IsSuccess)
            {
                Response.Redirect("workflowlist.aspx");
            }
        }
    }
}